This disclosure relates generally to computer memory devices, and more particularly to garbage collection in a solid state drive (SSD).
SSDs, which include flash memory devices, are rewritable non-volatile memory devices that use electronic circuitry for storing data. SSDs may be used for many types of computer memory, for example, local computer hard drives, peripheral storage, or storage for enterprise applications. SSDs offer relatively good bandwidth and random I/O (input/output) performance along with a relatively good lifespan due to an absence of moving parts.
SSD memory is organized in memory blocks. Each block includes a plurality of pages (a page is a relatively small unit of memory). Read and write operations in a SSD may be performed at the page level; however, erase operations may only be performed at the memory block level. Erase operations may also take more time to complete than read or write operations. In order to overwrite data (i.e., replace old data with updated data) that is stored in a memory block in a SSD, an erase operation of the entire memory block that holds the data to be overwritten must be performed. In order to overwrite data in a SSD, a writing technique referred to as “write out of place” may be applied, in which the updated data is written to a free (i.e., empty) page in the SSD memory instead of writing the updated data to the same page where old data resides. The page containing the old data is then marked as invalid page. An invalid page remains invalid until the entire memory block in which the invalid page is located is erased.
During operation of the SSD, garbage collection is performed to maintain a free block pool. The free block pool holds memory blocks that contain free pages that are available for writing new data. The free blocks are reclaimed from memory blocks that may be filled with both valid and invalid data. The garbage collection process first identifies a victim block for reclaiming. Any valid pages (i.e., pages containing data that has not been overwritten) residing in the victim block are copied to another memory block, and the victim block is erased, such that the entire victim block is now a free block for the free block pool. The garbage collection process requires read and write operations, in addition to the erase operation, that may compete with regular user read and write operations for access to the same memory and controller resources. Overly frequent garbage collection may increase write amplification in the SSD, which may increase the power consumption of the SSD and eventually decrease the lifespan of the SSD.